﻿using System.Diagnostics;
using Debug = UnityEngine.Debug;

namespace Core.Log {
    public class ADbg {
        private static DefaultLogWriter sWriter = new();
        
        //打印常规信息
        //[Conditional("LOG")]
        public static void Log(object message) {
            Debug.Log(message);
            sWriter.Record((string)message);
            sWriter.Record("[LOG]" + message);
        }
        //[Conditional("LOG")]
        public static void LogF(string message, params object[] p) {
            Debug.LogFormat(message, p);
            sWriter.Record("[LOG]" + message);
        }
        //[Conditional("LOG")]
        public static void LogW(object message) {
            Debug.LogWarning(message);
            sWriter.Record("[Warning]" + (string)message);
        }
        //[Conditional("LOG")]
        public static void LogWF(object message, params object[] p) {
            Debug.LogWarningFormat("[Warning]" + message, p);
            sWriter.Record("[Warning]" + message);
        }

        public static void LogI(object message) {
            Debug.Log(message);
            sWriter.Record("[Info]" + message);
        }

        public static void LogIF(string message, params object[] p) {
            Debug.LogFormat(message,p);
            sWriter.Record("[Info]" + message);
        }
        
        public static void LogE(object message) {
            Debug.LogError((string)message);
            sWriter.Record("[Error]" + message);
        }

        public static void LogEF(string message, params object[] p) {
            Debug.LogErrorFormat(message, p);
            sWriter.Record("[Error]" + message);
        }
    }
}